<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
 <script>
  function showInputNameValue() {
    console.log('我被点击了...')
    var btnComp = document.getElementById('name')
    console.log('按钮元素:'+btnComp)
    console.log('按钮元素:'+btnComp.value)
    console.log('按钮元素:'+btnComp.id)
    console.log('按钮元素:'+btnComp.type)
  }
</script>
</head>
<body>
  <input type="text" id="name">
<input type="button" value="测试按钮"  onclick="showInputNameValue()" />
</body>
  
</body>
</html>